(function () {
  var win = window,
      doc = document,
      docEle = doc.documentElement,
      body = doc.body,
      resizeEvent = "orientationchange" in win ? "orientationchange" : "resize",
      recalc = function () {
        var clientWidth = body.offsetWidth  || docEle.clientWidth,
            clientHeight = body.offsetHeight  || docEle.clientHeight,
            isIPhone = win.navigator.appVersion.match(/iphone/gi),
            isAndroid = win.navigator.appVersion.match(/android/gi),
            devicePixelRatio = win.devicePixelRatio
        clientWidth = clientWidth >= 500 ? 500 : clientWidth
        devicePixelRatio = 2
        docEle.style.fontSize = Math.floor(devicePixelRatio * clientWidth / 10) + 'px'
      }

    win.addEventListener(resizeEvent, recalc, false)
    doc.addEventListener("DOMContentLoaded", recalc, false)
})()